create table if not exists jms_dm.dm_tab_in_center_package_waybill_detail_dt
(
    scan_site_code        varchar(100) comment '扫描网点编号',
    site_agent_code       varchar(100) comment '所属代理区code',
    waybill_no            varchar(100) comment '运单编号',
    input_site            varchar(100) comment '扫描网点名称',
    site_agent_name       varchar(100) comment '所属代理区名称',
    network_type          int comment '扫描网点类型，1.加盟商,2.转运中心,3.集散点,4.普通网点,5.代理区,6.总部,0.其他',
    scan_time             varchar(100) comment '扫描时间',
    package_length        double comment '包裹总长,单位厘米',
    package_wide          double comment '包裹总宽,单位厘米',
    package_high          double comment '包裹总高,单位厘米',
    goods_type_code       varchar(100) comment '物品类型code',
    goods_type_name       varchar(100) comment '物品类型名称',
    package_charge_weight decimal(14, 2) comment '包裹计费重量,单位千克',
    package_code          varchar(100) comment '所属包号',
    second_code           varchar(100) comment '运单二段码',
    third_code            varchar(100) comment '运单三段码',
    second_package_code   varchar(100) comment '包二段码',
    third_package_code    varchar(100) comment '包三段码',
    scan_user             varchar(100) comment '扫描员',
    pack_scan_time        varchar(100) comment '建包扫描时间',
    need_way_flag         int comment '应建包票运单标识 1是,0否',
    error_pack_way_flag   int comment '错建包运单 0代表错建包运单 1代表未错建包运单',
    date_time             date comment '日期'
) ENGINE = OLAP DUPLICATE KEY( scan_site_code, site_agent_code)
COMMENT "进港建包统计报表明细"
PARTITION BY RANGE(date_time)
(START ("2022-09-01") END ("2022-10-15") EVERY (INTERVAL 1 day)
)
DISTRIBUTED BY HASH(waybill_no) BUCKETS 10
PROPERTIES (
"replication_num" = "3",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-370",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "10",
"in_memory" = "false",
"storage_format" = "V2"
);

